package com.example.demo.service;

import com.example.demo.dao.ClassroomDao;
import com.example.demo.entity.ClassroomEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ClassroomService {
    @Autowired
    private ClassroomDao classroomDao;
    /**
     * 通过ID查询单条数据
     */
    public ClassroomEntity queryClassroomById(Integer cid){
      return  classroomDao.queryClassroomById(cid);
    }

    /**
     * 通过实体作为筛选条件查询
     */
    public List<ClassroomEntity> queryClassroomAll(){
        return classroomDao.queryClassroomAll();
    }

    /**
     * 新增数据
     */
    public int insertClassroom(ClassroomEntity classroom){
       return classroomDao.insertClassroom(classroom);
    }

    /**
     * 修改数据
     */
    public int updateClassroom(ClassroomEntity classroom){
       return classroomDao.updateClassroom(classroom);
    }

    /**
     * 通过主键删除数据
     */
    public int deleteClassroomById(Integer cid){
       return classroomDao.deleteClassroomById(cid);
    }
    /**
     * 判断教室重名
     */
    public ClassroomEntity checkByCname(String cname){
       return classroomDao.checkByCname(cname);
    }

    //根据选择的教室类型查询有此楼下有多少教室
    public List<ClassroomEntity> selectClassByClassType(Integer ctid){
        return classroomDao.selectClassByClassType(ctid);
    }

    //通过borname查教室
    public List<ClassroomEntity> queryClassroomByEntity(ClassroomEntity classroomEntity) {
        return classroomDao.queryClassroomByEntity(classroomEntity);
    }

    //通过borname查教室
    public ClassroomEntity queryClassroomByBorname(String  borname) {
        return classroomDao.queryClassroomByBorname(borname);
    }

    //通过uid查教室
    public List<ClassroomEntity> queryClassroomByBid(ClassroomEntity classroomEntity) {
        return classroomDao.queryClassroomByBid(classroomEntity);
    }

    //通过楼层查教室
    public List<ClassroomEntity> seleByFid(int fid,int bid) {
        return classroomDao.seleByFid(fid,bid);
    }

}